<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Contatos</title>
    </h:head>
    <h:body>
        <h1>Contatos</h1>
        <h:form>
            
            <h:link value="Novo Contato" outcome="form" />
            
            <h:dataTable value="#{contatoMB.list}" var="reg">

                <h:column>
                    <f:facet name="header">
                        ID
                    </f:facet>
                    #{reg.id}
                </h:column>

                <h:column>
                    <f:facet name="header">
                        Nome
                    </f:facet>
                    #{reg.nome}
                </h:column>

                <h:column>
                    <f:facet name="header">
                        Email
                    </f:facet>
                    #{reg.email}
                </h:column>

                <h:column>
                    <f:facet name="header">
                        Telefone
                    </f:facet>
                    #{reg.telefone}
                </h:column>

                <h:column>
                    <f:facet name="header">
                        Ações
                    </f:facet>
                    <h:commandLink value="Editar" action="#{contatoMB.editar(reg)}"/>
                    <h:commandLink value="Excluir" action="#{contatoMB.excluir(reg)}"/>
                </h:column>

            </h:dataTable>
        </h:form>
    </h:body>
</html>

